package ListInsertionSorted;

/**
 * Created by sunwei on 2017/10/10
 * Time:16:06
 */
public class ListInsertionSortedApp {
    public static void main(String[] args) {
        int size = 10;
        Link[] linkArray = new Link[size];
        for(int i = 0; i <size ; i++) {
            int n = (int)(java.lang.Math.random()*99);
            Link newLink = new Link(n);
            linkArray[i] = newLink;
        }
        System.out.println("数组未排序之前：");
        for(int i = 0; i <size ; i++) {
            System.out.print(linkArray[i].dData+" " );
            System.out.println(" ");
        }

        SortedList sortedList = new SortedList(linkArray);
        for(int i = 0; i <size ; i++) {
            linkArray[i] = sortedList.remove();
        }
        System.out.println("数组进行表插入排序后：");
        for(int i = 0; i <size ; i++) {
            System.out.print(linkArray[i].dData+" " );
            System.out.println(" ");
        }
    }
}
